package DesignMode.Mediator;

/**
 * @author VX5
 * @Title: MJC
 * @ProjectName DataStructure
 * @Description: TODO
 * @date ${DAT}15:32
 */
public class ConcreteMediator extends Mediator {//具体中介者类
    private ConcreteColleague1 colleague1;
    private ConcreteColleague2 colleague2;

    public ConcreteMediator(ConcreteColleague1 colleague1) {
        this.colleague1 = colleague1;
    }

    public ConcreteMediator(ConcreteColleague2 colleague2) {
        this.colleague2 = colleague2;
    }

    @Override
    public void Send(String meassage, Colleague colleague) {
        if (colleague == colleague1){
            colleague2.Notify(meassage);
        }else {
            colleague1.Notify(meassage);
        }
    }
}
